package Day2;

import java.util.Random;
import java.util.Scanner;

/**
 * 名称test01
 * <p>
 * 描述
 *
 * @version 1.0
 * @author:DuanMM
 * @datatime:2024-05-21 20:38
 */
public class test01 {


    public static int add(int l,int r)
    {
        return l + r;
    }

    public static void main(String[] args) {

    }
    public static void main8(String[] args) {
        int i = 20,j = 10;
//        System.out.println(add(i,j));
        int ret = add(i,j);
        System.out.println("ret = " + ret);
    }

    public static void main7(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        System.out.printf("%x\n",num);
        int count = 0;
        while(num != 0)
        {
            num = num & (num - 1);
            count++;
        }
        System.out.println("count = " + count);
    }

    public static void main6(String[] args) {
        Random random = new Random(50); // 默认随机种子是系统时间
        Scanner sc = new Scanner(System.in);
        int toGuess = random.nextInt(100);
        // System.out.println("toGuess: " + toGuess);
        while (true) {
            System.out.println("请输入要输入的数字: (1-100)");
            System.out.println(toGuess);
            int num = sc.nextInt();
            if (num < toGuess) {
                System.out.println("低了");
            } else if (num > toGuess) {
                System.out.println("高了");
            } else {
                System.out.println("猜对了");
                break;
            }
        } sc.close();
    }

    public static void main5(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str1 = sc.next();
        System.out.println(str1 + "读取空格前的字符串");
        sc.nextLine();
        str1 = sc.nextLine();
        System.out.println(str1 + "读取一行字符串");
    }

    public static void main4(String[] args) {

        int num = 10;
        while(num >= 0)
        {
            System.out.print(num-- + " ");
        }
    }

    public static void main3(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        System.out.println(a);
    }

    public static void main2(String[] args) {
        //三目运算符
        System.out.println(10 > 11 ? 11 : 10);
    }

    public static void main1(String[] args) {
        int a1 = 0xffffffff;
        //无符号右移 -- 补充0
        System.out.printf("%x",a1 >>> 1);
    }
}
